/**
 * Created by Administrator on 2017-04-07.
 */
import Vue from 'vue'
import Vuex from 'vuex'
import mutations from './mutations'
import actions from './actions'
import createPersistedState from 'vuex-persistedstate'
Vue.use(Vuex)
console.log('config', config)
const state = {
    ip: config.ip,
    ossUrl: config.ossUrl,
    theme: '#d3a55d',
    hasLogin: true, // 登录状态
    userName: '', // 用户名称
    userInfo: {
        companyCode: 'YG000089',
        companyId: 89
    },
    buyStaffInfo: {
        adminId: 541,
        buyStaffType: 1,
        buyStaffId: 4,
        buyStaffName: 'lyq'
    },
    loginParams: {},
    tokens: '',
    timestamp: '',
    signature: '',
    msg: '', // 提示信息
    ret: 0, // 返回码
    showMsg: false, // 当变化的时候显示msg
    tipShow: false,
    currentPage: '', // 当前子页面
    isImplant: false,
    serviceMenu: 0
}

export default new Vuex.Store({
    state,
    actions,
    mutations,
    plugins: [
        createPersistedState({ storage: window.sessionStorage })
    ]
})
